<template>
  <div class="home">
    <wraptitle>
      <template v-slot:view-title>首页</template>
      <template v-slot:allmessage>
        <span class="allmessage">
          <el-badge :value="200" :max="99" class="item">
            <i class="el-icon-chat-line-round"></i>
          </el-badge>
        </span>
      </template>
    </wraptitle>
    <div class="charts-wrap">
      <!-- 成就徽章 -->
      <div class="chart-wrapper">
        <span class="chart-title">成就徽章</span>
        <div class="ach-badge">
          <div class="tag-group">
            <span class="tag-group__title">经验:</span>
            <el-tag
              :key="tag"
              v-for="tag in dynamicTags"
              closable
              class="tag-item"
              type="success"
              effect="dark"
              :disable-transitions="false"
              @close="handleClose(tag)"
            >
              {{ tag }}
            </el-tag>
            <el-input
              class="input-new-tag"
              v-if="inputVisible"
              v-model="inputValue"
              ref="saveTagInput"
              size="small"
              @keyup.enter.native="handleInputConfirm"
              @blur="handleInputConfirm"
            >
            </el-input>
            <el-button
              v-else
              class="button-new-tag"
              size="small"
              @click="showInput"
              >+ 添加徽章</el-button
            >
            <p class="beizhu">
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;备注：仅可输入8字，如软件开发实习，XX社团部长，请填写重要的
            </p>
          </div>
          <div class="tag-group">
            <span class="tag-group__title">证书:</span>
            <el-tag
              :key="tag"
              v-for="tag in dynamicTags2"
              closable
              class="tag-item"
              type=""
              effect="dark"
              :disable-transitions="false"
              @close="handleClose2(tag)"
            >
              {{ tag }}
            </el-tag>
            <el-input
              class="input-new-tag"
              v-if="inputVisible2"
              v-model="inputValue2"
              ref="saveTagInput2"
              size="small"
              @keyup.enter.native="handleInputConfirm2"
              @blur="handleInputConfirm2"
            >
            </el-input>
            <el-button
              v-else
              class="button-new-tag"
              size="small"
              @click="showInput2"
              >+ 添加徽章</el-button
            >
            <p class="beizhu">
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;备注：仅可输入8字，CET4，CET6，计算机二级，普通话二乙，请填写重要的
            </p>
          </div>
          <div class="tag-group">
            <span class="tag-group__title">荣誉:</span>
            <el-tag
              :key="tag"
              v-for="tag in dynamicTags3"
              closable
              class="tag-item"
              type="warning"
              effect="dark"
              :disable-transitions="false"
              @close="handleClose3(tag)"
            >
              {{ tag }}
            </el-tag>
            <el-input
              class="input-new-tag"
              v-if="inputVisible3"
              v-model="inputValue3"
              ref="saveTagInput3"
              size="small"
              @keyup.enter.native="handleInputConfirm3"
              @blur="handleInputConfirm3"
            >
            </el-input>
            <el-button
              v-else
              class="button-new-tag"
              size="small"
              @click="showInput3"
              >+ 添加徽章</el-button
            >
            <p class="beizhu">
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;备注：仅可输入8字，校三好学生，市三好学生，互联网+校一等，微软市三等，请写重要的
            </p>
          </div>
          <div class="tag-group">
            <span class="tag-group__title">技能:</span>
            <!-- <el-tag
              v-for="item in items4"
              :key="item.label"
              :type="item.type"
              class="tag-item"
              effect="dark">
              {{ item.label }}
            </el-tag> -->
            <el-tag
              :key="tag"
              v-for="tag in dynamicTags4"
              closable
              class="tag-item"
              type="danger"
              effect="dark"
              :disable-transitions="false"
              @close="handleClose4(tag)"
            >
              {{ tag }}
            </el-tag>
            <el-input
              class="input-new-tag"
              v-if="inputVisible4"
              v-model="inputValue4"
              ref="saveTagInput4"
              size="small"
              @keyup.enter.native="handleInputConfirm4"
              @blur="handleInputConfirm4"
            >
            </el-input>
            <el-button
              v-else
              class="button-new-tag"
              size="small"
              @click="showInput4"
              >+ 添加徽章</el-button
            >
            <p class="beizhu">
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;备注：JAVA，PYTHON请写自己掌握可用的
            </p>
          </div>
        </div>
      </div>
      <!-- 知识与技能 -->
      <!-- <div class="chart-container">
        <mix-chart height="100%" width="100%" />
      </div> -->
      <!-- 折线图 -->
      <!-- <div class="chart-wrapper">
        <span class="chart-title">知识：学习成绩</span>
        <line-charts :userId="userId" />
      </div> -->
      <!-- 能力：雷达图(测评能力)-->
      <div class="chart-radar-wrap">
        <span class="chart-title">能力：通用能力</span>
        <div class="chart-font">
          <span class="chart-font-tip">能力自评结果，请继续延长-补短</span>
        </div>
        <div class="wrap-flex">
          <div class="wrap-flex-item">
            <radar-charts :userId="userId" />
          </div>
        </div>
      </div>
      <!-- 风格：行为风格(测评能力)-->
      <div class="chart-disc-wrap">
        <span class="chart-title">行为风格：DISC</span>
        <div class="chart-font">
          <span class="chart-font-tip"
            >{{
              this.isqueryuserId
                ? this.iceberguserInfo.userName
                : this.userInfo.userName
            }}的行为风格为：{{ this.resultStrength }}</span
          >
        </div>
        <div class="wrap-flex">
          <div class="wrap-flex-item">
            <img
              src="http://qiniu.careerai.com.cn/DISC.png"
              class="disc-img"
              alt="DISC行为风格"
            />
          </div>
          <div class="wrap-flex-item">
            <span class="disc-pie"
              ><pie-chart :userId="userId" @resultStrength="getresultStrength"
            /></span>
          </div>
        </div>
      </div>
      <!-- 动机：职业锚(测评能力)-->
      <div class="chart-disc-wrap">
        <span class="chart-title">动机：职业锚</span>
        <div class="chart-font">
          <span class="chart-font-tip"
            >{{
              this.isqueryuserId
                ? this.iceberguserInfo.userName
                : this.userInfo.userName
            }}的职业价值观是：{{ this.resultStrengthZym }}</span
          >
        </div>
        <div class="wrap-flex">
          <div class="wrap-flex-item">
            <img
              src="http://qiniu.careerai.com.cn/%E8%81%8C%E4%B8%9A%E9%94%9A.png"
              class="zym-img"
              alt="职业锚"
            />
          </div>
          <div class="wrap-flex-item">
            <span class="disc-zym"
              ><bar-chart
                :userId="userId"
                @resultStrengthZym="getresultStrengthZym"
            /></span>
          </div>
        </div>
      </div>
      <!-- 人格：九型(测评能力)-->
      <div class="chart-disc-wrap">
        <span class="chart-title">人格：九型</span>
        <div class="chart-font">
          <span class="chart-font-tip"
            >{{
              this.isqueryuserId
                ? this.iceberguserInfo.userName
                : this.userInfo.userName
            }}的九型人格是：{{ this.resultStrengthJx }}</span
          >
        </div>
        <div class="wrap-flex">
          <div class="wrap-flex-item">
            <img
              src="http://qiniu.careerai.com.cn/%E4%B9%9D%E5%9E%8B%E4%BA%BA%E6%A0%BC.png"
              class="jx-img"
              alt="九型人格"
            />
          </div>
          <div class="wrap-flex-item">
            <span class="disc-jx"
              ><cross-chart
                :userId="userId"
                @resultStrengthJx="getresultStrengthJx"
            /></span>
          </div>
        </div>
      </div>
      <!-- 性格：MBTI(测评能力)-->
      <div class="chart-disc-wrap">
        <span class="chart-title">性格：MBTI</span>
        <div class="chart-font">
          <span class="chart-font-tip"
            >{{
              this.isqueryuserId
                ? this.iceberguserInfo.userName
                : this.userInfo.userName
            }}的职业性格是：{{ this.resultStrengthMBTI }}</span
          >
        </div>
        <div class="wrap-flex">
          <div class="wrap-flex-item">
            <img
              src="http://qiniu.careerai.com.cn/MBTI.png"
              class="MBTI-img"
              alt="MBTI"
            />
          </div>
          <div class="wrap-flex-item">
            <span class="disc-MBTI">
              <span class="wrap-flex-bar">
                <span class="wrap-flex-item-bar"
                  ><stackbarleft-chart :userId="userId"
                /></span>
                <span class="wrap-flex-item-bar"
                  ><stackbarright-chart
                    :userId="userId"
                    @resultStrengthMBTI="getresultStrengthMBTI"
                /></span>
              </span>
            </span>
          </div>
        </div>
      </div>
      <!-- 兴趣：霍兰德(测评能力)-->
      <div class="chart-disc-wrap">
        <span class="chart-title">兴趣：霍兰德</span>
        <div class="chart-font">
          <span class="chart-font-tip"
            >{{
              this.isqueryuserId
                ? this.iceberguserInfo.userName
                : this.userInfo.userName
            }}的职业兴趣是：{{ this.resultStrengthHLD }}</span
          >
        </div>
        <div class="wrap-flex">
          <div class="wrap-flex-item">
            <img
              src="http://qiniu.careerai.com.cn/%E9%9C%8D%E5%85%B0%E5%BE%B7.png"
              class="hld-img"
              alt="霍兰德"
            />
          </div>
          <div class="wrap-flex-item">
            <span class="disc-hld"
              ><hldradar-chart
                :userId="userId"
                @resultStrengthHLD="getresultStrengthHLD"
            /></span>
          </div>
        </div>
      </div>
      <!-- 天赋：HBDI(测评能力)-->
      <div class="chart-disc-wrap">
        <span class="chart-title">天赋：HBDI</span>
        <div class="chart-font">
          <span class="chart-font-tip"
            >{{
              this.isqueryuserId
                ? this.iceberguserInfo.userName
                : this.userInfo.userName
            }}的全脑优势偏：{{ this.resultStrengthHBDI }}</span
          >
        </div>
        <div class="wrap-flex">
          <div class="wrap-flex-item">
            <img
              src="http://qiniu.careerai.com.cn/HBDI.png"
              class="HBDI-img"
              alt="HBDI"
            />
          </div>
          <div class="wrap-flex-item">
            <span class="disc-HBDI"
              ><tfpie-chart
                :userId="userId"
                @resultStrengthHBDI="getresultStrengthHBDI"
            /></span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { request } from '../../network/request'
import { mapActions, mapGetters } from 'vuex'

import wraptitle from '../../components/content/WrapTitle'
import RaddarChart from '../Home/components/RaddarChart'
import PieChart from '../Home/components/PieChart'
import BarChart from '../Home/components/BarChart'
import radarCharts from '../Home/components/radarCharts'
import lineCharts from '../Home/components/lineCharts'
import mixChart from '../Home/components/mixChart'
import crossChart from '../Home/components/CrossChart'
import stackbarrightChart from '../Home/components/StackbarrightChart'
import stackbarleftChart from '../Home/components/StackbarleftChart'
import hldradarChart from '../Home/components/HldradarChart'
import tfpieChart from '../Home/components/TfpieChart'

export default {
  name: 'home',
  data() {
    return {
      messageCards: [
        {
          backgroundColor: '#00B7F1',
          icon: 'icon-article',
          topMessage: '共提交了',
          middleMessage: '0',
          bottomMessage: '篇职业规划',
          to: 'careerplanManage'
        },
        {
          backgroundColor: '#00B872',
          icon: 'icon-drafts',
          topMessage: '草稿箱共有',
          middleMessage: '0',
          bottomMessage: '篇职业规划',
          to: 'careerplanDrafts'
        },
        {
          backgroundColor: '#658DD2',
          icon: 'icon-classify',
          topMessage: '共有',
          middleMessage: '0',
          bottomMessage: '个时段/专家',
          to: 'timeslotexperts'
        },
        {
          backgroundColor: '#F2A14D',
          icon: 'icon-comments',
          topMessage: '共有',
          middleMessage: '0',
          bottomMessage: '条专家评论',
          to: 'careerplanComments'
        }
      ],
      chartData: {
        columns: ['日期', '访问用户', '下单用户', '下单率'],
        rows: [
          { 日期: '1/1', 访问用户: 1393, 下单用户: 1093, 下单率: 0.32 },
          { 日期: '1/2', 访问用户: 3530, 下单用户: 3230, 下单率: 0.26 },
          { 日期: '1/3', 访问用户: 2923, 下单用户: 2623, 下单率: 0.76 },
          { 日期: '1/4', 访问用户: 1723, 下单用户: 1423, 下单率: 0.49 },
          { 日期: '1/5', 访问用户: 3792, 下单用户: 3492, 下单率: 0.323 },
          { 日期: '1/6', 访问用户: 4593, 下单用户: 4293, 下单率: 0.78 }
        ]
      },
      items: [
        { type: '', label: '实习' },
        { type: 'success', label: '项目' },
        { type: 'info', label: '班长' },
        { type: 'danger', label: '学委' },
        { type: 'warning', label: '社团' }
      ],
      items2: [
        { type: '', label: 'CET4' },
        { type: 'success', label: 'CET6' },
        { type: 'info', label: '计算机二级' }
      ],
      items3: [
        { type: '', label: '获奖' },
        { type: 'success', label: '三好学生' },
        { type: 'info', label: '优秀学生' }
      ],
      items4: [
        { type: '', label: 'Java' },
        { type: 'success', label: 'Python' }
      ],
      // dynamicTags: ['实习', '项目', '班长', '学委', '社团'],
      dynamicTags: [],
      dynamicTags2: [],
      dynamicTags3: [],
      dynamicTags4: [],
      inputVisible: false,
      inputVisible2: false,
      inputVisible3: false,
      inputVisible4: false,
      inputValue: '',
      inputValue2: '',
      inputValue3: '',
      inputValue4: '',
      avatar: require('@/assets/img/avatar.png'),
      career: require('@/assets/img/avatar.png'),
      isAdminUser: true,
      roleId: true,
      sex: '',
      resultStrength: '（未知）',
      resultStrengthZym: '（未知）',
      resultStrengthJx: '（未知）',
      resultStrengthMBTI: '（未知）',
      resultStrengthHLD: '（未知）',
      resultStrengthHBDI: '（未知）',
      medalid: 0,
      objmedals: [{ usermedal_Id: 0, medalName: '' }],
      usermedalId: 0,
      isqueryuserId: false,
      messages: [],
      messageTotal: 0,
      userInfo: '',
    }
  },
  components: {
    wraptitle,
    RaddarChart,
    PieChart,
    BarChart,
    radarCharts,
    lineCharts,
    mixChart,
    crossChart,
    stackbarrightChart,
    stackbarleftChart,
    hldradarChart,
    tfpieChart
  },
  computed: {
    ...mapGetters(['userId', 'userinfo'])
  },
  methods: {
    ...mapActions([
      'getHomeStatisticsCount',
      'getUserMedalByUserId',
      'selectMedals',
      'addMedals',
      'selectUsermedal',
      'addUsermedal',
      'deleteUsermedal',
      'getIcebergUserInfoByUserId',
      'messageList',
      'updateMessage'
    ]),
    tabHandleClick(tab, event) {
      //this.getMessage()
      //console.log(tab, event);
    },
    getAvatar() {
      return this.userInfo.role_Id > 2 ? this.career : this.avatar
    },

    geticeberg() {
      let id = this.$route.query.user_Id
      if (id) {
        this.getIcebergUserInfoByUserId(id)
          .then(info => {
            this.getusermedalByuserId()
            this.$toast(
              this.iceberguserInfo.userName + '的冰山模型构建完成。',
              'success'
            )
          })
          .catch(err => {
            this.$toast(err.msg, 'error')
          })
      }
    },
    getMessage() {
      let params = {
        to_id: this.userInfo.user_Id,
        isread: 0,
        size: 6,
        current: 1,
        orders: ['m.create_time desc']
      }
      this.messageList(params).then(res => {
        this.messages = res.data
        this.messageTotal = res.page.totalCount
      })
    },
    updateRoute(name) {
      this.$router.push({
        name: name,
        query: {}
      })
    },
    gethomestatisticscount() {
      this.getHomeStatisticsCount({
        user_Id: this.userInfo.role_Id > 2 ? '' : this.userInfo.user_Id,
        is_author: this.userInfo.role_Id > 2 ? '' : 0
      })
        .then(data => {
          this.messageCards[0].middleMessage = data.data.publishCount
            ? data.data.publishCount
            : 0
          this.messageCards[1].middleMessage = data.data.draftsCount
            ? data.data.draftsCount
            : 0
          this.messageCards[2].middleMessage =
            (data.data.timeslotCount ? data.data.timeslotCount : 0) +
            '/' +
            (data.data.expertsCount ? data.data.expertsCount : 0)
          this.messageCards[3].middleMessage = data.data.commentsCount
            ? data.data.commentsCount
            : 0
        })
        .catch(() => {})
    },

    deleteusermedal(tag) {
      // console.log(this.objmedals)
      let objmedal = this.objmedals.find(item => item.medalName === tag)
      if (objmedal) {
        this.usermedalId = objmedal.usermedal_Id
        // console.log(this.usermedalId)
        this.deleteUsermedal(this.usermedalId)
          .then(data => {
            this.$toast(data.msg, 'success')
          })
          .catch(err => {
            this.$toast(err.msg, 'error')
          })
      } else {
        return
      }
    },

    selectmedals(inputValue, TypeId) {
      let params = {
        medalName: inputValue,
        medalType_Id: TypeId
      }
      this.selectMedals(params)
        .then(data => {
          // console.log(data.data[0].medalName)
          // console.log(params.medalName)
          if (data.status == 1) {
            if (data.data[0].medalName == params.medalName) {
              // this.$toast('该徽章已存在无需重复添加', 'error')
              this.medalid = data.data[0].medal_Id
              this.selectusermedal()
            } else {
              this.addmedal(params.medalName, params.medalType_Id)
            }
          } else {
            this.addmedal(params.medalName, params.medalType_Id)
          }
        })
        .catch(err => {
          this.$toast(err.msg, 'error')
        })
    },

    addmedal(inputValue, TypeId) {
      let params = {
        medalName: inputValue,
        medalType_Id: TypeId
      }
      this.addMedals(params)
        .then(data => {
          // console.log(data.data.medal_Id)
          if (data.status == 1) {
            this.medalid = data.data.medal_Id
            this.selectusermedal()
            // console.log(data.data.medal_Id)
            // this.$toast('添加成功！', 'success')
          } else {
            return
          }
        })
        .catch(err => {
          this.$toast(err.msg, 'error')
        })
    },

    selectusermedal() {
      let params = {
        medal_Id: this.medalid,
        user_Id: this.userInfo.user_Id
      }
      this.selectUsermedal(params)
        .then(data => {
          if (data.status == 1) {
            this.$toast('该徽章已添加无需重复添加', 'error')
          } else {
            this.addusermedal()
          }
        })
        .catch(err => {
          this.$toast(err.msg, 'error')
        })
    },

    addusermedal() {
      let params = {
        medal_Id: this.medalid,
        user_Id: this.userInfo.user_Id
      }
      this.addUsermedal(params)
        .then(data => {
          if (data.status == 1) {
            this.$toast('徽章添加成功！', 'success')
            this.getusermedalByuserId()
          } else {
            return
          }
        })
        .catch(err => {
          this.$toast(err.msg, 'error')
        })
    },

    getusermedalByuserId() {
      this.dynamicTags = []
      this.dynamicTags2 = []
      this.dynamicTags3 = []
      this.dynamicTags4 = []
      this.getUserMedalByUserId(
        this.isqueryuserId
          ? this.iceberguserInfo.user_Id
          : this.userInfo.user_Id
      )
        .then(data => {
          // console.log(data.data[0].medals.medalName)
          // this.dynamicTags = data.data
          // console.log(data.data)
          var arr = new Array()
          arr = data.data
          if (arr) {
            for (let i = 0; i < arr.length; i++) {
              const el = arr[i]
              const medalType_Id = el.medals.medalTypes.medalType_Id
              const obj = {}
              obj.usermedal_Id = el.usermedal_Id
              obj.medalName = el.medals.medalName
              this.objmedals.push(obj)
              // this.objmedals.forEach(item => {
              //     item.usermedal_Id = el.medals.medal_Id
              //     item.medalName = el.medals.medalName
              // })
              // this.objmedals.push([usermedal_Id] = el.medals.medal_Id
              // this.objmedals[medalName] = el.medals.medalName
              if (medalType_Id == 1) {
                this.dynamicTags.push(el.medals.medalName)
              }
              if (medalType_Id == 2) {
                this.dynamicTags2.push(el.medals.medalName)
              }
              if (medalType_Id == 3) {
                this.dynamicTags3.push(el.medals.medalName)
              }
              if (medalType_Id == 4) {
                this.dynamicTags4.push(el.medals.medalName)
              }
            }
          } else {
            return
          }
        })
        .catch(err => {
          // this.$toast(err.msg, 'error')
        })
    },

    getresultStrength(resultStrength) {
      this.resultStrength = resultStrength
    },
    getresultStrengthZym(resultStrengthZym) {
      this.resultStrengthZym = resultStrengthZym
    },
    getresultStrengthJx(resultStrengthJx) {
      this.resultStrengthJx = resultStrengthJx
    },
    getresultStrengthMBTI(resultStrengthMBTI) {
      this.resultStrengthMBTI = resultStrengthMBTI
    },
    getresultStrengthHLD(resultStrengthHLD) {
      this.resultStrengthHLD = resultStrengthHLD
    },
    getresultStrengthHBDI(resultStrengthHBDI) {
      // console.log(resultStrengthHBDI.slice(0,1))
      this.resultStrengthHBDI = resultStrengthHBDI.slice(0, 1)
    },

    handleClose(tag) {
      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1)
      this.deleteusermedal(tag)
    },
    handleClose2(tag) {
      this.dynamicTags2.splice(this.dynamicTags2.indexOf(tag), 1)
      this.deleteusermedal(tag)
    },
    handleClose3(tag) {
      this.dynamicTags3.splice(this.dynamicTags3.indexOf(tag), 1)
      this.deleteusermedal(tag)
    },
    handleClose4(tag) {
      this.dynamicTags4.splice(this.dynamicTags4.indexOf(tag), 1)
      this.deleteusermedal(tag)
    },
    showInput() {
      this.inputVisible = true
      this.$nextTick(_ => {
        this.$refs.saveTagInput.$refs.input.focus()
      })
    },
    showInput2() {
      this.inputVisible2 = true
      this.$nextTick(_ => {
        this.$refs.saveTagInput2.$refs.input.focus()
      })
    },
    showInput3() {
      this.inputVisible3 = true
      this.$nextTick(_ => {
        this.$refs.saveTagInput3.$refs.input.focus()
      })
    },
    showInput4() {
      this.inputVisible4 = true
      this.$nextTick(_ => {
        this.$refs.saveTagInput4.$refs.input.focus()
      })
    },
    handleInputConfirm() {
      let inputValue = this.inputValue
      if (inputValue) {
        // this.dynamicTags.push(inputValue);
        this.selectmedals(inputValue, 1)
      }
      this.inputVisible = false
      this.inputValue = ''
    },
    handleInputConfirm2() {
      let inputValue2 = this.inputValue2
      if (inputValue2) {
        // this.dynamicTags2.push(inputValue2);
        this.selectmedals(inputValue2, 2)
      }
      this.inputVisible2 = false
      this.inputValue2 = ''
    },
    handleInputConfirm3() {
      let inputValue3 = this.inputValue3
      if (inputValue3) {
        // this.dynamicTags3.push(inputValue3);
        this.selectmedals(inputValue3, 3)
      }
      this.inputVisible3 = false
      this.inputValue3 = ''
    },
    handleInputConfirm4() {
      let inputValue4 = this.inputValue4
      if (inputValue4) {
        // this.dynamicTags4.push(inputValue4);
        this.selectmedals(inputValue4, 4)
      }
      this.inputVisible4 = false
      this.inputValue4 = ''
    },
    messageRead(type, id, jump) {
      if (type == 1) {
        this.$router.push({
          name: 'careerplanPreview',
          query: {
            careerplan_id: jump
          }
        })
      }
      if (type == 2) {
        this.$router.push({
          name: 'applyjob',
          query: {}
        })
      }
      if (type == 3) {
        this.$router.push({
          name: 'resumePreview',
          query: {
            resume_id: jump
          }
        })
      }
      let params = {
        isread: true,
        messageId: id
      }
      this.updateMessage(params)
        .then(res => {
          if (res.status == 1) {
            this.$notify({
              title: '成功',
              message: res.msg,
              type: 'success'
            })
          } else {
            this.$toast(res.msg, 'error')
          }
        })
        .catch(err => {
          this.$toast(err.msg, 'error')
        })
    }
  },
  created() {
    this.userInfo = JSON.parse(this.userinfo)
  }
}
</script>

<style lang="stylus" scoped>
@import '../../stylus/color.styl'
@import '../../stylus/mixin.styl'
#admin-home
  position: relative
  padding-top: 52px
  > p
    position: fixed
    width: 100%
    top: 0
    padding: 18px
    font-size: 16px
    font-weight: bold
    background-color: $color-white
    box-shadow: 1px 1px 10px 1px rgba(38, 42, 48, .1)
    z-index: 1000
  .avatar
    position: fixed
    right: 65px
    width: 30px
    height: 30px
    top: 13px
    margin-right:5px
    border-radius: 50%
  .user-name
    position: fixed
    right: 15px
  .message
    position: fixed
    right: 120px
  .card-wrap
    position: relative
    animation: show .8s
    margin: 10px
    display: flex
    flex-direction: row
    flex-wrap: wrap
    align-items: flex-start
  .chart-container
    position: relative
    width: 100%
    height: calc(100vh - 84px)
    margin-bottom 20px
    animation: show .8s
    background-color: rgb(240, 242, 245)
  .charts-wrap
    //padding: 18px
    animation: show .8s
    background-color: rgb(240, 242, 245)
    position: relative
    .chart-wrapper
      background: rgb(240, 242, 245)
      // padding: 16px 16px 0
    .chart-title
        color: #434649
        font-size: 22px
        font-weight: bold
    .chart-font
        color: #434649
        font-size: 22px
        font-weight: bold
        text-align: center
        .chart-font-tip
          margin-top: 10px
    .chart-radar-wrap
      padding: 5px
      .wrap-flex
        display: flex
        text-align: center
        background-color: rgb(240, 242, 245)
        .wrap-flex-item
          flex: 1
          margin: 20px
        .wrap-flex-item + .wrap-flex-item
          margin-left: 5px
          margin-right: 5px
    .wrap-flex-bar
      display: flex
      text-align: center
      background-color: rgb(240, 242, 245)
      .wrap-flex-item-bar
        flex: 1
        margin: 2px
      .wrap-flex-item-bar + .wrap-flex-item-bar
        margin-left: 1px
        margin-right: 1px
    .chart-disc-wrap
      padding: 5px
      .disc-pie
        position: relative
        top: 20px
      .disc-zym
        position: relative
        top: 40px
      .disc-jx
        position: relative
        top: 40px
      .disc-MBTI
        position: relative
        top: 30px
      .disc-hld
        position: relative
        top: 20px
      .disc-HBDI
        position: relative
        top: 20px
      .wrap-flex
        width: 100%
        text-align: center
        background-color: rgb(240, 242, 245)
        > div
          display: inline-block    /* 如需支持IE8以下版本，用浮动来做 */
          width: calc(100% / 2.09)    /* 此处运用了一个css3的表达式，将div三等分，IE8及以上可以支持，当然也可以根据需要设置固定值 */
          width: -webkit-calc(100% /2.09) /*3.09 排除margin的宽度*/
          width: -moz-calc(100% / 2.09)
          height: 100%
  .text
    font-size: 14px
  .item
    margin-bottom: 18px
  .clearfix:before,
  .clearfix:after
    display: table
    content: ""
  .clearfix:after
    clear: both
  .box-card
    width: 100%
    text-align: center
    .aboutme-name
      margin-top: 10px
      margin-left: 50px
      font-size: 18px
      @media (max-width: 768px)
        font-size: 22px
      font-weight: bold
  .icebergMode
      padding: 10px
      background-color: $color-white
      background-position: center
      background-size: cover
      background-image: url('http://qiniu.careerai.com.cn/icebergMode.png')
      border-radius: 3px
      .ice-font
        text-align: center
      .ice-font-title
        padding-top: 15px
        color: #fff
        font-size: 24px
        font-weight: bold
      .ice-font-top
        padding:0px 15px
        margin-left: 200px
        color: #000
        font-size: 22px
        font-weight: bold
      .ice-font-down
        padding:10px 15px
        margin-left: 150px
        color: #fff
        font-size: 24px
        font-weight: bold
    .tip
      // height: 180px
      padding: 10px
      background-color: $color-main
      color: #FFFFFF
      .tip-title
        padding-bottom: 10px
        font-size: 18px
        font-weight: bold
      .erweima-tip
        font-weight: bold
        float: right
        margin-right: 80px
      .gongzonghao-tip
        font-weight: bold
        float: right
        margin-right: 70px
      .tip-content
        font-size: 20px
        margin-left: 20px
    .bottom-state
      padding: 10px
      background-color: $color-main
      text-align: center
      .bottom-content
        margin-left: 20px
        color: $color-light-grey
        font-size: 12px
  .card-info
    padding: 10px
    background-color: rgb(240, 242, 245)
    .card-info-wrap
      margin: 10px
      width: 70%
      .card-info-title
        margin: 5px
        font-size: 18px
        color: #000
        font-weight: bold
      .card-info-number
        margin-left: 3px
        font-size: 18px
        color: #000
        font-weight: bold
      .card-info-pro
        margin-top: -23px
        margin-left: 68px
  .ach-badge
    padding: 0px 20px 30px 20px
    margin: 10px
    background-color: rgb(240, 242, 245)
    .tag-item
      margin: 10px
  .tag-group__title
    font-size: 18px
    font-weight: bold
  .beizhu
    font-size: 13px
    color: #777777

  .el-tag + .el-tag {
    margin-left: 10px;
  }
  .button-new-tag {
    margin-left: 10px;
    height: 32px;
    line-height: 30px;
    padding-top: 0;
    padding-bottom: 0;
  }
  .input-new-tag {
    width: 90px;
    margin-left: 10px;
    vertical-align: bottom;
  }

  .erweima-site
    float:right
    margin-right: 50px
    .erweima
      padding: 10px
      width: 127px
      height: 127px
      background-position: center
      background-size: cover
      background-image: url('http://qiniu.careerai.com.cn/%E5%B0%8F%E7%A8%8B%E5%BA%8F.JPG')
      border-radius: 3px
  .gongzonghao-site
    float:right
    margin-right: 50px
    .gongzonghao
      padding: 10px
      width: 127px
      height: 127px
      background-position: center
      background-size: cover
      background-image: url('http://qiniu.careerai.com.cn/%E6%99%BA%E8%83%BD%E8%81%8C%E4%B8%9A%E8%A7%84%E5%88%92.jpg')
      border-radius: 3px


@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
  .box-card {
    width: 280px
  }
  .icebergMode {
    width: 100%
    height: 550px
  }
}


@keyframes show {
  from {
    margin-top: 0px;
    opacity: 0;
  }
  to {
    margin-top: 10px;
    opacity: 1;
  }
}
</style>
<style>
.allmessage {
  position: fixed;
  right: 138px;
  margin-top: 20px;
}
.disc-img {
  margin-top: 10px;
  margin-bottom: 60px;
  width: 352px;
  height: 276px;
}
.HBDI-img {
  margin-top: 30px;
  margin-bottom: 30px;
  width: 285px;
  height: 305px;
}

.hld-img {
  margin-bottom: 50px;
  width: 442px;
  height: 238px;
}
.MBTI-img {
  margin-bottom: 30px;
  width: 472px;
  height: 292px;
}
.jx-img {
  margin-bottom: 50px;
  width: 452px;
  height: 286px;
}
.zym-img {
  margin-bottom: 30px;
  width: 432px;
  height: 304px;
}
</style>
